package com.ljm.security.loginprocessor;

import com.ljm.security.enums.LoginTypeEnum;

import javax.servlet.ServletRequest;

import static org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.SPRING_SECURITY_FORM_PASSWORD_KEY;
import static org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.SPRING_SECURITY_FORM_USERNAME_KEY;

/**
 * @author: ChenHuaMing
 * @Date: 2020/6/12 17:34
 * @Description:
 */
public class FormLoginPostProcessor implements LoginPostProcessor {
    @Override
    public LoginTypeEnum getLoginTypeEnum() {
        return LoginTypeEnum.FORM;
    }
    @Override
    public String obtainUsername(ServletRequest request) {
        return request.getParameter(SPRING_SECURITY_FORM_USERNAME_KEY);
    }

    @Override
    public String obtainPassword(ServletRequest request) {
        return request.getParameter(SPRING_SECURITY_FORM_PASSWORD_KEY);
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        return super.equals(obj);
    }
}
